import React from 'react';
import { ActionPanel, PanelItemType } from '@/components';

interface KnowledgeListProps {
  taskList?: PanelItemType[];
  className?: string;
}

const KnowledgeList: React.FC<KnowledgeListProps> = ({ taskList, className }) => {
  // 过滤出知识库搜索相关的任务
  const knowledgeTasks = taskList?.filter(task => 
    task?.messageType === 'knowledge' || 
    (task?.messageType === 'tool_result' && task?.toolResult?.toolName === 'knowledge_search')
  ) || [];

  return (
    <div className={className}>
      {knowledgeTasks.map((task, index) => (
        <div key={task?.id || index} className="mb-4">
          <ActionPanel
            taskItem={task}
            allowShowToolBar={true}
          />
        </div>
      ))}
      {knowledgeTasks.length === 0 && (
        <div className="text-center text-gray-500 mt-8">
          暂无知识库搜索结果
        </div>
      )}
    </div>
  );
};

export default KnowledgeList; 